import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.vaadinpa.data.Coordinate;
import org.vaadinpa.data.Planet;
import org.vaadinpa.data.Resource;
import org.vaadinpa.data.Universe;
import org.vaadinpa.logic.CommandHandler;
import org.vaadinpa.logic.commands.TickCommand;

public class ResourceTest {

	private Planet planet;

	public void buildData() {

		planet = new Planet(Coordinate.getRandom());
		planet.addRoids(Resource.METAL, 1);

		Universe.instance.put(planet.coords, planet);
	}

	@Test
	public void testResourceAggregation() {

		buildData();

		assertTrue(planet.getFunds(Resource.METAL) == 0);

		CommandHandler.handle(new TickCommand());

		assertTrue(planet.getFunds(Resource.METAL) > 0);

	}
}
